package com.hibase.core.rule.service.ruletable.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.hibase.core.mybatis.service.BaseServiceImpl;
import com.hibase.core.rule.entity.ruletable.RuleTableData;
import com.hibase.core.rule.entity.ruletable.vo.RuleTableDataSearchVO;
import com.hibase.core.rule.mapper.ruletable.RuleTableDataMapper;
import com.hibase.core.rule.service.ruletable.RuleTableDataService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 动态规则数据表 服务实现类
 * </p>
 *
 * @author hufeng
 * @since 2019-06-10
 */
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
public class RuleTableDataServiceImpl extends BaseServiceImpl<RuleTableDataMapper, RuleTableData> implements RuleTableDataService {

    /**
     * 查询动态规则数据表列表
     */
    @Override
    public PageInfo<RuleTableData> selectRuleTableDataList(RuleTableDataSearchVO searchVO) {

        return super.page(searchVO, new QueryWrapper<RuleTableData>());
    }

    /**
     * 改变动态规则数据表记录
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveRuleTableData(RuleTableData entity) {

        super.store(entity);
    }

    /**
     * 查询动态规则数据表详情
     */
    @Override
    public RuleTableData viewRuleTableData(String id) {

        RuleTableData entity = super.getById(id, true);

        return entity;
    }

    /**
     * 删除动态规则数据表记录
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteRuleTableData(String id) {

        super.deleteBy(id);
    }
}
